using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DTO;
using BUS;


namespace DoAn
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        Boolean flag = false;
        DataSet ds = new DataSet();
        DataView dv = new DataView();
        QLHS obj = new QLHS();

        private void Form1_Load(object sender, EventArgs e)
        {
            //ds = obj.LayDanhSach();
            //dv.Table = ds.Tables["sinhvien"];
            //dv.Sort = "tensv";

            //flag = true;
        }

        private void tsbtnThem_Click(object sender, EventArgs e)
        {
            HocSinhDTO emp = new HocSinhDTO();

            emp.MAHOCSINH = this.txtMaHS.Text;
            emp.HOTEN = this.txtTenHS.Text;
            emp.GIOITINH = this.radNam.Text;
            emp.NGAYSINH = DateTime.Parse(this.dateTimePicker1.Value);
            emp.NOISINH = this.txtNoiSinh.Text;
            emp.DANTOC = this.cbxDanToc.Text;
            emp.TONGIAO = this.cbxTonGiao.Text;
            emp.TENCHA = this.txtTenCha.Text;
            emp.NGHENGHIEPCHA = this.cbxNgheCha.Text;
            emp.TENME = this.txtTenMe.Text;
            emp.NGHENGHIEPME = this.cbxNgheMe.Text;
            bool result = HocSinhBUS.InsertHocSinh(emp);
            if (result == true)
            {
                MessageBox.Show("Successful!", "Insert", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //this.ShowMaster();
            }
            else
            {
                MessageBox.Show("Fail!\r\nChoose new EmployeeID,Please!", "Insert", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void tsbtnLamMoi_Click(object sender, EventArgs e)
        {
            txtMaHS.Text = "";
            txtTenHS.Text = "";
            radNam.Checked = true;
            dateTimePicker1.Value = DateTime.Today();
            txtNoiSinh.Text = "";
            cbxDanToc.Text = "";
            cbxTonGiao.Text = "";
            txtTenCha.Text = "";
            cbxNgheCha.Text = "";
            txtTenMe.Text = "";
            cbxNgheMe.Text = "";
        }
    }
}